package com.itheima.web.cookie;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet("/BServlet")
public class  BServlet extends HttpServlet {
    @Override
    protected void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
         Cookie []cookies=request.getCookies();
         for(Cookie cookie:cookies)
         {
             if(cookie.getName().equals("name"))
             {
                 System.out.println(cookie.getValue());
                 break;
             }
         }
    }

    @Override
    protected void doPost (HttpServletRequest request, HttpServletResponse response) throws
    ServletException, IOException {
        this.doGet(request, response);
    }
}
